import type { ILogin } from '@/type/index.d'
import { request } from './../index'

/**
 * 登陆
 * @param account
 * @param password
 * @returns
 */
export const loginApi = (obj: ILogin) => {
  return request.post({
    url: '/login',
    data: {
      account: obj.account,
      password: obj.password
    }
  })
}

/**
 * 获取用户信息
 * @param id
 * @returns
 */
export const getUserInfoByIdApi = (id: number) => {
  return request.get({
    url: `/users/${id}`,
  })
}

export const getUserMenusByRoleIdApi = (id: number) => {
  return request.get({
    url: `/role/menu/${id}`
  })
}

export const testApi = () => {
  return request.get({
    url: '/test',
    method: 'get'
  })
}
